<template>
  <div>
<table>
    <tr>
        <td>书名</td>
        <td>作者</td>
        <td>封面</td>
        <td>操作</td>
    </tr>
    <tr v-for="book in book_list" :key="book.id">
        <td>{{book.book_name}}</td>
        <td><img :src="'http://127.0.0.1:8000/' + book.img" alt=""></td>
        <td>{{book.author.author_name}}</td>
        <td></td>
    </tr>
</table>
  </div>
</template>

<script>
import axios from 'axios'
export default {
    data() {
        return {
            base_url:'http://127.0.0.1:8000',
            book_list:[],
        }
    },
    methods:{
        get_book() {
            axios({
                url:this.base_url + '/app01/show_book/',
            }).then(resp=>{
                console.log(resp.data)
                this.book_list=resp.data
            })
        }
    },
    created() {
        this.get_book()
    }
}
</script>

<style>

</style>